package com.smh.a03ExercisesDemo1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test3 {
    public static void main(String[] args) {
        //点名不重复

        ArrayList<Integer> list = new ArrayList<>();
        Collections.addAll(list,1,2,3,4,5,6,7,8,9);
        ArrayList<Integer> list1 = new ArrayList<>();
        Random random = new Random();

        int length = list.size();
        //轮数
        for (int i = 0; i < length; i++) {
            //点名
            while (list.size()!=0){
                int name = list.remove(random.nextInt(list.size()));
                System.out.println(name);
                list1.add(name);
            }
            list.addAll(list1);
            list1.clear();
            System.out.println("-----------------------");
        }




    }
}
